/*

	AppKit
	-------

	@file 		AppKit.js
	@version 	$Revision: 22 $
	@date 		$Date: 2011-04-21 22:08:21 +0000 (Thu, 21 Apr 2011) $
	@author 	$Author: me@gideonfarrell.co.uk $

	Copyright (c) 2011 Gideon Farrell <http://www.gideonfarrell.co.uk>

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
	HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
	INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR
	FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE
	OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
	COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.COPYRIGHT HOLDERS WILL NOT
	BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL
	DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.

	You should have received a copy of the GNU General Public License
	along with this program. If not, see <http://gnu.org/licenses/>.

*/

/**
 * AKFileTypes enumerator.
*/
var AKFileTypes = new Enum(["GENERIC", "JAVASCRIPT", "CSS", "IMAGE", "JSON"]);

/**
 * AppKit Class
*/
var AppKit = new Class({
	Singleton: true,
	Implements: [Options, Events],
	options: {
		showSplash:	false,
		loadAssets: []
	},
	
	/**
	 * initialize function.
	 * Initialises the AppKit, displaying the splash screen if necessary and also loading assets.
	 *
	 * @access public
	 * @param Object options
	 * @return void
	*/
	initialize: function(options) {
		this.setOptions(options); 
		
		/* !Todo: complete stub "initialize" */
	}
	
	/**
	 * load function.
	 * Loads an AppKit asset (CSS, Javascript)
	 *
	 * @access public
	 * @param AKFileType type
	 * @param array files
	 * @param string root_location
	 * @return void
	*/
	
	load: function(type, files, root_location) {
		// If no root location is specified, take the current URL as the assumed location of loader.js and load relative to that.
		if(!$chk(root_location)) {
			root_location = window.location.href;
		}
		
		switch(type) {
			case AKFileTypes.JAVASCRIPT:
				/*
					Process javascript
						There is some debate in my mind as to whether to run packaging scripts in the client (id erat: process all package manifests etc. and compute dependencies w/i the browser (keep in mind that this will not be as efficient as server side partially due to decreased caching ability) OR whether to keep it server side.
						I think I'll stick with server side.
						Therefore this function should really just do minor loading of assets with event firing when complete.
				*/
				break;
			case AKFileTypes.CSS:
				/*
					Process CSS
						See above discussion (monologue).
				*/
				break;
			default:
				// Do I want to deal with anything else? Images? There are no library images by design because everything will be purely rendered by the browser so probs not.
		}
	},
});